package com.alks.entity.data.entity.imes;

import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.regex.Pattern;

public class StyleSize implements Serializable, Comparable<StyleSize> {
  private String rowid;
  
  private String companyId;
  
  @NotEmpty(message = "型体不为空")
  private String styleNo;
  
  private String sizeNo;
  
  private Integer seqNo;
  
  private String cutSize;
  
  private String lastSize;
  
  private String soleSize;
  
  private String insoleSize;
  
  private Integer lastLength;
  
  private String midsoleSize;
  
  private String custSize;
  
  private static final long serialVersionUID = 1L;
  
  public String getRowid() {
    return this.rowid;
  }
  
  public void setRowid(String rowid) {
    this.rowid = rowid;
  }
  
  public Integer getSeqNo() {
    return this.seqNo;
  }
  
  public void setSeqNo(Integer seqNo) {
    this.seqNo = seqNo;
  }
  
  public String getCutSize() {
    return this.cutSize;
  }
  
  public void setCutSize(String cutSize) {
    this.cutSize = (cutSize == null) ? null : cutSize.trim();
  }
  
  public String getLastSize() {
    return this.lastSize;
  }
  
  public void setLastSize(String lastSize) {
    this.lastSize = (lastSize == null) ? null : lastSize.trim();
  }
  
  public String getSoleSize() {
    return this.soleSize;
  }
  
  public void setSoleSize(String soleSize) {
    this.soleSize = (soleSize == null) ? null : soleSize.trim();
  }
  
  public String getInsoleSize() {
    return this.insoleSize;
  }
  
  public void setInsoleSize(String insoleSize) {
    this.insoleSize = (insoleSize == null) ? null : insoleSize.trim();
  }
  
  public Integer getLastLength() {
    return this.lastLength;
  }
  
  public void setLastLength(Integer lastLength) {
    this.lastLength = lastLength;
  }
  
  public String getMidsoleSize() {
    return this.midsoleSize;
  }
  
  public void setMidsoleSize(String midsoleSize) {
    this.midsoleSize = (midsoleSize == null) ? null : midsoleSize.trim();
  }
  
  public String getCompanyId() {
    return this.companyId;
  }
  
  public void setCompanyId(String companyId) {
    this.companyId = companyId;
  }
  
  public String getStyleNo() {
    return this.styleNo;
  }
  
  public void setStyleNo(String styleNo) {
    this.styleNo = styleNo;
  }
  
  public String getSizeNo() {
    return this.sizeNo;
  }
  
  public void setSizeNo(String sizeNo) {
    this.sizeNo = sizeNo;
  }
  
  public String getCustSize() {
    return this.custSize;
  }
  
  public void setCustSize(String custSize) {
    this.custSize = custSize;
  }
  
  public int compareTo(StyleSize o) {
    if (null == o || this.sizeNo == null || o.sizeNo == null)
      return 0; 
    if (Pattern.matches("^0{1,4}$", this.sizeNo)) {
      if (Pattern.matches("^0{1,4}$", o.sizeNo))
        return o.sizeNo.length() - this.sizeNo.length(); 
      return -1;
    } 
    if (this.sizeNo.startsWith("C")) {
      if (Pattern.matches("^0{1,4}$", o.sizeNo))
        return 1; 
      if (o.sizeNo.startsWith("C")) {
        float f1 = Float.valueOf(this.sizeNo.substring(1)).floatValue();
        float f2 = Float.valueOf(o.sizeNo.substring(1)).floatValue();
        if (f1 < f2)
          return -1; 
        if (f1 > f2)
          return 1; 
        return 0;
      } 
      return -1;
    } 
    if (Pattern.matches("^0{1,4}$", o.sizeNo) || o.sizeNo.startsWith("C"))
      return 1; 
    float o1 = Float.valueOf(this.sizeNo).floatValue();
    float o2 = Float.valueOf(o.sizeNo).floatValue();
    if (o1 < o2)
      return -1; 
    if (o1 > o2)
      return 1; 
    return 0;
  }
}
